Telegram Group & Telegram Channel
Что выведет следующий код на Python?


a = 256
b = 256
c = 257
d = 257

print(a is b) # #1
print(c is d) # #2

print(True + True + True == 3) # #3
print(True is 1) # #4
print(False == 0) # #5
print(False is 0) # #6


🔢 Варианты ответа:

A)

True
True
True
True
True


B)

False
True
False
True
False


C)

False
True
False
True
False


D)

True
False
False
False
False


Правильный ответ: B

💡 Почему?
-
a is bTrue, потому что int от -5 до 256 кэшируются.
-
c is dFalse, число 257 не кэшируется.
-
True + True + True == 3True, более того, True == 1.
-
True is 1False — это разные типы (bool и int).
-
False == 0True, False is 0False.



tg-me.com/pro_python_code/1788
Create:
Last Update:

Что выведет следующий код на Python?


a = 256
b = 256
c = 257
d = 257

print(a is b) # #1
print(c is d) # #2

print(True + True + True == 3) # #3
print(True is 1) # #4
print(False == 0) # #5
print(False is 0) # #6


🔢 Варианты ответа:

A)

True
True
True
True
True


B)

False
True
False
True
False


C)

False
True
False
True
False


D)

True
False
False
False
False


Правильный ответ: B

💡 Почему?
-
a is bTrue, потому что int от -5 до 256 кэшируются.
-
c is dFalse, число 257 не кэшируется.
-
True + True + True == 3True, более того, True == 1.
-
True is 1False — это разные типы (bool и int).
-
False == 0True, False is 0False.

BY Python RU


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/pro_python_code/1788

View MORE
Open in Telegram


Python RU Telegram | DID YOU KNOW?

Date: |

Start with a fresh view of investing strategy. The combination of risks and fads this quarter looks to be topping. That means the future is ready to move in.Likely, there will not be a wholesale shift. Company actions will aim to benefit from economic growth, inflationary pressures and a return of market-determined interest rates. In turn, all of that should drive the stock market and investment returns higher.

To pay the bills, Mr. Durov is issuing investors $1 billion to $1.5 billion of company debt, with the promise of discounted equity if the company eventually goes public, the people briefed on the plans said. He has also announced plans to start selling ads in public Telegram channels as soon as later this year, as well as offering other premium services for businesses and users.

Python RU from ua


Telegram Python RU
FROM USA